DevForce Help Reference
DelegateVerifier<T> Constructor(String,VerifierCondition<T>)
Example 


Error message for failed verification
Defines the verification to be performed
Initializes a new instance of the DelegateVerifier class.
Syntax
'Declaration
 
Public Function New( _
   ByVal errorMessage As String, _
   ByVal verifierCondition As IdeaBlade.Validation.VerifierCondition(Of T) _
)
'Usage
 
Dim errorMessage As String
Dim verifierCondition As IdeaBlade.Validation.VerifierCondition(Of T)
 
Dim instance As New DelegateVerifier(Of T)(errorMessage, verifierCondition)
public DelegateVerifier<T>( 
   string errorMessage,
   IdeaBlade.Validation.VerifierCondition<T> verifierCondition
)

Parameters

errorMessage
Error message for failed verification
verifierCondition
Defines the verification to be performed
Example
private DelegateVerifier SampleDelegateVerifier() {
   // A simple example adding a delegate verifier for the Employee HireDate property.
   // This verifier could more easily be handled using a DateTimeRangeVerifier,
   // but is intended to show the parts to a DelegateVerifier.

   string errorMessage = "HireDate must be greater than MinValue";

   // Define the verification test. 
   VerifierCondition<Employee> condition = (emp, trigger, ctx) => {
     // Note when executed before the property is set that we must inspect the ProposedValue.
     DateTime? hireDate = (trigger.Timing == TriggerTiming.BeforeSet) ? (DateTime?) trigger.ProposedValue : emp.HireDate;
     return new VerifierResult(hireDate >= DateTime.Parse("1/1/2000"));
   };

   // Create the verifier.
   var v = new DelegateVerifier<Employee>(errorMessage, condition);

   // Add a trigger - here it's the HireDate property.
   v.AddTrigger(Employee.PropertyMetadata.HireDate.Name);

   return v;
 }
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

DelegateVerifier<T> Class
DelegateVerifier<T> Members
Overload List

Send Feedback